<!DOCTYPE html>


<html lang="zn-CH">


<head>
  <meta charset="utf-8" />
    
  <meta name="description" content="What I can do is to Do My Personal Best!" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    java面试基础部分; |  小熊的博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="http://www.cdn.adingxiong.com/b5363a06dc744d79a94021492bcefe27" />
  
  
<link rel="stylesheet" href="/blog/dist/main.css">

  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">

  
<link rel="stylesheet" href="/blog/css/custom.css">

  
  
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

  
  

  

<link rel="alternate" href="/blog/atom.xml" title="小熊的博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content on">
      <section class="outer">
  <article id="post-java面试基础部分" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  java面试基础部分;
</h1>
 

    </header>
    

    
    <div class="article-meta">
      <a href="/blog/2019/03/25/java%E9%9D%A2%E8%AF%95%E5%9F%BA%E7%A1%80%E9%83%A8%E5%88%86/" class="article-date">
  <time datetime="2019-03-25T03:43:02.000Z" itemprop="datePublished">2019-03-25</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/blog/categories/java%E9%9D%A2%E8%AF%95%E7%9B%B8%E5%85%B3/">java面试相关</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">1.4k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">5 min</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      
      

      
      <h3 id="1-java的四大基础特征"><a href="#1-java的四大基础特征" class="headerlink" title="1. java的四大基础特征"></a>1. java的四大基础特征</h3><h4 id="1-抽象（一般没有提）"><a href="#1-抽象（一般没有提）" class="headerlink" title="1*.抽象（一般没有提）"></a>1*.抽象（一般没有提）</h4><p> 父类为子类提供一些属性和行为，子类根据业务需求实现具体的行为;</p>
<p> 抽象类使用<code>abstract</code>进行修饰，子类需要实现父类的所有抽象方法，否则子类也是抽象类。</p>
<h4 id="2-封装"><a href="#2-封装" class="headerlink" title="2.封装"></a>2.封装</h4><p> 把对象的数据或者行为（方法）整合中一个独立的整理，并尽可能的隐藏对象的内部实现细节;</p>
<p> 我们一般隐藏该方法的形式是使用<code>private</code>修饰，并通过<code>get</code>和<code>set</code>方法对外提供访问接口。</p>
<h4 id="3-继承"><a href="#3-继承" class="headerlink" title="3.继承"></a>3.继承</h4><p> 子类继承父类的属性和方法，并可以根据自己的需求扩展出新的属性或者功能，提高代码的复用性。</p>
<p> <em>java</em><code>的继承是通过</code>extends`关键字实现的，没继承的类叫父类，继承的类称为子类。子类拥有父类的属性和特征，并可以进行扩充。</p>
<p><code>overide</code>：当子父类出现相同的方法，会先运行子类的方法</p>
<p> 重新的特点：<strong>方法名一样，访问修饰符权限不小于父类，返回类型一致，返回参数列表相同</strong></p>
<h4 id="4-多态"><a href="#4-多态" class="headerlink" title="4.多态"></a>4.多态</h4><p> 不修改程序的代码就可以改变程序运行时所绑定的具体代码，让程序可以选择多种运行状态，具体的实现方式：接口实现，继承父类进行方法重写，同一类的中方法的重载。</p>
<p> 封装和继承都是为java语言的多态提供支撑，多态存在的三个必要条件是：继承，重写，父类引用指向子类。</p>
<h3 id="2-Servlet"><a href="#2-Servlet" class="headerlink" title="2. Servlet"></a>2. Servlet</h3><h4 id="1-servlet-是什么？"><a href="#1-servlet-是什么？" class="headerlink" title="1. servlet 是什么？"></a>1. servlet 是什么？</h4><p> <code>servlet</code>称为小服务程序或者服务连接器，用java编写的服务器端程序，具有独立的平台协议特性，主要功能是在于交互式浏览和生成数据，生成动态<code>web</code>内容。</p>
<h4 id="2-servlet的生命周期是什么？"><a href="#2-servlet的生命周期是什么？" class="headerlink" title="2. servlet的生命周期是什么？"></a>2. servlet的生命周期是什么？</h4><p>  服务器启动时， （<code>web.xml</code>中配置 <code>load-on-startup=0</code>,默认为0)，或者第一次请求该<code>servlet</code>时，就会初始化一个Servlet对象，初始的时候会执行<code>init(ServletConfig conf)</code>，该<code>servlet</code>对象去处理所有客户端请求，在<code>servlet(ServletRequest req ,ServletResponse res)</code>方法中执行，最后服务器关闭时，才会毁掉这个<code>servlet</code>对象，执行<code>destroy</code>方法。</p>
<p>  <img src="https://raw.githubusercontent.com/supbadboy/image/master/20190325200538.png" alt></p>
<h4 id="3-servlet中几个比较重要的对象"><a href="#3-servlet中几个比较重要的对象" class="headerlink" title="3. servlet中几个比较重要的对象"></a>3. servlet中几个比较重要的对象</h4><p>  <strong><code>servletConfig</code>对象</strong></p>
<p>获取方式 ： <code>getServletConfig()</code> </p>
<p>功能：</p>
<ul>
<li><code>getServletName()</code>,获取web.xml中配置的<code>Servlet-name</code>;</li>
</ul>
<ul>
<li><code>getServletContext()</code>,获取<code>ServletContext</code>对象;</li>
</ul>
<ul>
<li><code>getInitParameter(String)</code>,获取在servlet中初始化参数的值;</li>
</ul>
<ul>
<li><code>getInitParameterNames()</code>,获取在Servlet中所有初始化参数的名字，也就是key值.</li>
</ul>
<p><strong><code>ServletContext</code>对象</strong></p>
<p>获取途径：<code>getServletContext(); 、getServletConfig().getServletContext()</code>;</p>
<p>功能：</p>
<ol>
<li><p><code>web</code>项目中共享数据，<code>getAttribute(String name)、setAttribute(String name, Object obj)、removeAttribute(String name)</code>;</p>
</li>
<li><p>整个<code>web</code>项目初始化参数,<code>getInitPatameter(String name)</code>,通过指定名称获取初始化<code>getInitParameterNames()</code>获得枚举类型.</p>
</li>
<li><p>获取web项目资源</p>
</li>
</ol>
<ul>
<li>获取web项目下指定资源的路径：<code>getServletContext().getRealPath(&quot;/WEB-INF/web.xml&quot;)</code>.</li>
<li>获取web项目下指定资源的内容，返回的是字节输入流。<code>InputStream getResourceAsStream(java.lang.String path)</code>.</li>
<li><code>getResourcePaths(java.lang.String path)</code>  指定路径下的所有内容</li>
</ul>
<p><strong>request对象和response对象我们就比较熟悉了，所以不一一列举了</strong></p>
<h3 id="3-JSP的标签"><a href="#3-JSP的标签" class="headerlink" title="3. JSP的标签"></a>3. JSP的标签</h3><h4 id="3-1-El-表达式语言，EL表达式"><a href="#3-1-El-表达式语言，EL表达式" class="headerlink" title="3.1 El(表达式语言，EL表达式)"></a>3.1 El(表达式语言，EL表达式)</h4><p>用来替代 &lt;%=  %&gt;</p>
<p>1) 语法：  ${ }</p>
<p>2) 作用：</p>
<pre><code>1. 可以自动从4个Scope(作用域)中获取数据
    1. Scope包括：  
        1. pageContext（当前jsp页面）
        2. request
        3. session
        4. servletContext
    2. 从小到大逐个去找，找到就返回，都找不到就什么都不返回
2. 读取访问到的数据
    1. 包装类或String：直接访问，如${count}
            注：可以通过pageScope，requestScope,sessionScope, applicationScope来指定仅从对应的Scope中找数据
            如：${requestScope.count}是仅在request中查找count变量，有则返回，无则什么都不显示
    2. 数组： 数组变量名[下标]，如：array[0]
    3. 集合： 集合变量名[下标]，如：list[0]
    4. Map: map变量名[&quot;key&quot;],如：map[&quot;name&quot;]
                或 map变量名.key 如：map.name
    5. 对象：变量名.属性名，如：user.username
                注：实际是调用对应的get方法，如没有get方法会报错
    6. 综合应用：如 list[0].username

    7. 获取用户请求参数 param.username

    3. 将数据显示在页面上</code></pre><h4 id="3-2-JSTL-JSP标准标签库"><a href="#3-2-JSTL-JSP标准标签库" class="headerlink" title="3.2 JSTL JSP标准标签库"></a>3.2 JSTL JSP标准标签库</h4><p>1) 使用JSTL的步骤</p>
<pre><code>1. 导入jstl.jar

        &lt;dependency&gt;
            &lt;groupId&gt;jstl&lt;/groupId&gt;
            &lt;artifactId&gt;jstl&lt;/artifactId&gt;
            &lt;version&gt;1.2&lt;/version&gt;
        &lt;/dependency&gt;

2. 在jsp上添加 &lt;%@ taglib prefix=&quot;&quot; uri=&quot;&quot; %&gt;
    声明所使用的标签库
    prefix：标签的前缀
    uri: 指明具体使用哪个子库
    子库：
        core 核心库（使用率最高的库）
        fmt  格式化相关的库 格式化输出日期，金额...
        --- 下面的很少用 ---
        functions    为EL提供增强功能 （很少用）
        xml  解析XML所使用的库
        sql  访问数据库所使用的库

3. 在页面上使用对应的标签

        &lt;c:if&gt;
        &lt;c:choose&gt;
        &lt;c:forEach&gt;</code></pre><p>2) c:if<br>    1. 执行判断<br>    2. test=””<br>    3. var=””<br>    4. scope=””</p>
<p>3) c:choose</p>
<p>4) c:forEach</p>
<p>实现循环</p>
<ol>
<li>begin:循环开始的位置</li>
<li>end:循环结束的位置</li>
<li>step:循环的步长</li>
<li>var:循环变量</li>
<li>itmes:指定遍历的集合或数组</li>
<li>varStatus:保存了循环状态的对象<br> count，当前循环的次数</li>
</ol>
<p>5）fmt:formatNumber</p>
<ol>
<li>value</li>
<li>pattern：指定输出的样式</li>
</ol>
<p>6）fmt:formatDate</p>
<ol>
<li>value</li>
<li>pattern：指定输出的样式</li>
</ol>
<h4 id="3-3-JSP的九大内置对象"><a href="#3-3-JSP的九大内置对象" class="headerlink" title="3.3 JSP的九大内置对象"></a>3.3 JSP的九大内置对象</h4><ol>
<li><p>out            : JSPWriter</p>
</li>
<li><p>request        : HttpServletRequest</p>
</li>
<li><p>response        : HttpServletResponse</p>
</li>
<li><p>session        : HttpSession</p>
</li>
<li><p>application    : ServletContext</p>
</li>
<li><p>pageContext    : PageContext</p>
</li>
<li><p>config        : ServletConfig</p>
</li>
<li><p>exception    : Throwable(上一个页面出现的异常)(基本不用)</p>
</li>
<li><p>page            : Servlet(this)</p>
</li>
</ol>

      
      <!-- reward -->
      
      <div id="reward-btn">
        Donate
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>Copyright： </strong>
              Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://bodboy.gitee.io/blog/2019/03/25/java%E9%9D%A2%E8%AF%95%E5%9F%BA%E7%A1%80%E9%83%A8%E5%88%86/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/" rel="tag">技术文档</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/%E9%9D%A2%E8%AF%95/" rel="tag">面试</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/blog/2019/04/17/%E5%A6%82%E4%BD%95%E5%9C%A8linux%E6%9C%8D%E5%8A%A1%E4%B8%8A%E5%88%9B%E5%BB%BAvnc%E6%9C%8D%E5%8A%A1/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            如何在linux服务上创建vnc服务
          
        </div>
      </a>
    
    
      <a href="/blog/2019/02/28/%E5%A6%82%E4%BD%95%E5%9C%A8github%E4%B8%8A%E4%BC%A0%E5%A4%9A%E4%B8%AA%E9%A1%B9%E7%9B%AE/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">如何在github上传多个项目</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'uW8QYGvvhWmNWdiwpznJ0GVa-gzGzoHsz',
        app_key: 'LrJhMzx9qEwcMV1DJjTI6f6C',
        path: window.location.pathname,
        notify: 'false',
        verify: 'false',
        avatar: '[object Object]',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2019-2021
        <i class="ri-heart-fill heart_icon"></i> panda
      </li>
    </ul>
    <ul>
      <li>
        
        
        
        Powered by <a href="https://hexo.io" target="_blank">Hexo</a>
        <span class="division">|</span>
        Theme - <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/blog/"><img src="https://portrait.gitee.com/uploads/avatars/user/1007/3023420_bodboy_1578973210.png!avatar200" alt="小熊的博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/tags/%E6%97%85%E8%A1%8C/">旅行</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/blog/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/blog/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/blog/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/blog/js/jquery-2.0.3.min.js"></script>


<script src="/blog/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/blog/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/blog/dist/main.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>


<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>




<script src="/blog/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>

  
<script src="/blog/js/clickLove.js"></script>



<!-- 复制 -->



    
    <div id="music">
    
    
    
    <iframe frameborder="no" border="1" marginwidth="0" marginheight="0" width="200" height="52"
        src="//music.163.com/outchain/player?type=2&id=1297802566&auto=1&height=32"></iframe>
</div>

<style>
    #music {
        position: fixed;
        right: 15px;
        bottom: 0;
        z-index: 998;
    }
</style>
    
  </div>
</body>

</html>